// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ResourceManager.cs" company="">
//   
// </copyright>
// <summary>
//   Defines the ResourceManager type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace ComparisonTool.Connection
{
    using System.Drawing;
    using System.Reflection;

    /// <summary>
    /// The resource manager.
    /// </summary>
    public class ResourceManager
    {
        /// <summary>
        /// The get image.
        /// </summary>
        /// <param name="name">
        /// The name.
        /// </param>
        /// <returns>
        /// The <see cref="Image"/>.
        /// </returns>
        public static Image GetImage(string name)
        {
            Assembly myAssembly = Assembly.GetAssembly(typeof(ResourceManager));

            using (var myStream = myAssembly.GetManifestResourceStream(name))
            {
                if (myStream != null)
                {
                    return new Bitmap(myStream);
                }
            }

            return null;
        }
    }
}
